/**
 * Created with JetBrains PhpStorm.
 * User: ishowshao
 * Date: 12-7-23
 */

FlyFight = {
    version: '0.0.1'
};

Zen.namespace('FlyFight.view.airplane');
Zen.namespace('FlyFight.model.airplane');

FlyFight.view.CELL_WIDTH_HEIGHT = 20;
FlyFight.model.airplane.NORMAL = 1;
FlyFight.model.airplane.SHOTTED = 2;
FlyFight.model.airplane.CRASHED = 3;

Zen.Application({
    name: 'FlyFight',
    controllers: ['InfoList', 'User'],
    views: ['Grid', 'Chessboard', 'Airport', 'airplane.Renderer', 'airplane.F15', 'RequestList', 'LoginForm'],
    models: ['Matrix', 'airplane.F15', 'User'],
    launch: function () {
        console.log('launch called');
        var airport = Zen.View.instance(FlyFight.view.Airport, {
            x: 10,
            y: 10
        });
        airport.render();

        //创建我方棋盘
        var myChessboard = Zen.View.instance(FlyFight.view.Chessboard, {
            droppable: true
        });
        myChessboard.render('#my-chessboard-ct');

        var yourChessboard = Zen.View.instance(FlyFight.view.Chessboard, {
            fire: true
        });
        yourChessboard.render('#your-chessboard-ct');

        var airplane1 = Zen.View.instance(FlyFight.view.airplane.F15);
        var pos1 = airport.getGrid().getOffset();
        pos1.top += 1;
        pos1.left += 1;
        airplane1.render(pos1);

        var airplane2 = Zen.View.instance(FlyFight.view.airplane.F15);
        var pos2 = airport.getGrid().getOffset();
        pos2.top += 1;
        pos2.left += 1 + (FlyFight.view.CELL_WIDTH_HEIGHT + 1) * 5;
        airplane2.render(pos2);

        var airplane3 = Zen.View.instance(FlyFight.view.airplane.F15);
        var pos3 = airport.getGrid().getOffset();
        pos3.top += 1 + (FlyFight.view.CELL_WIDTH_HEIGHT + 1) * 5;
        pos3.left += 1;
        airplane3.render(pos3);
    }
});



